var token;
$.ajax({
		url: 'http://139.224.208.224/damei-manager//qiniuyun/getToken.do',
		type: 'get',
		async: false,
		cache: false,
		success: function(data) {
			token = data
		}
});
function IdImg(id, container, img) {
	console.log(token)
	var uploader = new Qiniu.uploader({
		runtimes: 'html5,flash,html4',
		browse_button:id,
		uptoken: token,
		get_new_uptoken: false,
		unique_names: true,
		domain: 'ou5331fwu.bkt.clouddn.com',
		container: container,
		max_file_size: '100mb',
		max_retries: 3,
		dragdrop: true,
		drop_element: container,
		chunk_size: '4mb',
		auto_start: true,
		init: {
			'FilesAdded': function(up, files) {
				plupload.each(files, function(file) {});
			},
			'BeforeUpload': function(up, file) {},
			'UploadProgress': function(up, file) {},
			'FileUploaded': function(up, file, info) {
				var domain = up.getOption('domain');
				var res = JSON.parse(info);
				var sourceLink = "http://" + domain + "/" + res.key;
				console.log(sourceLink);
					$("#"+img).show();
					$("#"+img).attr('src', sourceLink);
					$("#"+img).siblings().find(".imgBox2").hide();
			},
			'Error': function(up, err, errTip) {
				alert(err);
			},
			'UploadComplete': function() {},
			'Key': function(up, file) {
				var key = "";
				return key
			}
		}
	});
}
